import { connect } from 'react-redux';
import homeReducer, {
  getBanner,
  getRecomdList,
  getLatestList,
  getDistinctList
} from '../store/home';
import reducer, { getExperList } from '../store/experience';
import { injectReducer } from '../store/reducers';
import store from '../store/createStore';
import HomeView from '../components/HomeView';

const mapDispatchToProps = {
  getBanner,
  getRecomdList,
  getExperList,
  getLatestList,
  getDistinctList
};

const mapStateToProps = state => ({
  bannerList: state.home.banner.bannerList,
  recomdList: state.home.recomd.recomdList,
  latestList: state.home.latest.latestList,
  experienceList: state.experience.list,
  distinctList: state.home.distinct.distinctList
});

injectReducer(store, { key: 'home', reducer: homeReducer });
injectReducer(store, { key: 'experience', reducer });
export default connect(
  mapStateToProps,
  mapDispatchToProps
)(HomeView);
